<?php
require_once "utils/db.php";
require_once "utils/util.php";

$db = new db();
	$query = 	'SELECT * '.
				'FROM entities '.
				'ORDER BY name;';
	$domains = $db -> rawSelect($query);
$db->close();
$totalCount = sizeof($domains);
$names = "";
foreach($domains as $domain){
	$names .= ',{"name":"'.$domain['label'].'", "ID":"'.$domain['id'].'"}';
}
$names = substr($names,1);
$callback = $_GET['callback'];
?>
<?=$callback?>({
    "totalCount":"<?=$totalCount?>",
    "Names":[
        <?=$names?>
    ]
})
